package cn.edu.tsinghua.smxq.mobilecity.utils;

import java.util.Random;

public class RandomNumber {
	
	public static String getTranSerialNo(int length){
		 Random randGen = null;
		 char[] numbersAndLetters =null;
	
		 if (length < 1) {
             return null;
         }
         if (randGen == null) {
                randGen = new Random();
                numbersAndLetters = ("0123456789abcdefghijklmnopqrstuvwxyz" +
                   "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
                  //numbersAndLetters = ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
                 }
         char [] randBuffer = new char[length];
         for (int i=0; i<randBuffer.length; i++) {
             randBuffer[i] = numbersAndLetters[randGen.nextInt(71)];
          //randBuffer[i] = numbersAndLetters[randGen.nextInt(35)];
         }
         return new String(randBuffer);

		
	}

}
